<template>
    <div>
        <button @click="fireEvent">通过this.$parent返回消息给父组件</button>
        <div>通过直接引用组件得到子组件的消息: {{ childMessage }}</div>
        <child ref="ref_child"></child>

    </div>
</template>
<script>
    import Child from '@/views/event_ref/Child.vue';
    export default {
        components: {
            Child
        },
        props: {

        },
        data () {
            return {
                childMessage: ""
            }
        },
        mounted(){

        },
        /**
         * 计算属性
         */
        computed: {

        },
        methods: {
            fireEvent() {
                /**
                 * 发送on-message消息
                 */
                this.$refs.ref_child.message = "我是父组件设置的信息";
            }
        }
    }
</script>
<style scoped>

</style>